package com.example.myapplication;


import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast;

/**
 * Created by lyt on 2020/12/5 0005.
 */

public class MyDatabase extends SQLiteOpenHelper {

    public static final String CREATE_Recycle= "create table User("
            +"username varchar primary key ,"
            +"password varchar )";

    private Context mContext;

    public MyDatabase(Context context, String name, SQLiteDatabase.CursorFactory factory, int version){
        super(context,name,factory,version);
        mContext = context;
    }

    @Override
    //创建数据库
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_Recycle);
        Toast.makeText(mContext,"Create succeeded",Toast.LENGTH_LONG).show();
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }


}
